/**
 * @author planderos
 * Handle's hulu popup
 */


function infoPopupButtonHandler(e)
{
	var dctk = connected.toolkit;

	switch(e.buttonId)
	{
		case dcKeyEvent.BUTTON_ID_BACK:
		{
			dctk.dismissPopup();
		}
		break;
		
		case dcKeyEvent.BUTTON_ID_MENU:
		{
			dctk.dismissPopup();
			showQueueIdPopup();
		}
		break;

	}
}

function showInfoPopup()
{
	var dctk = connected.toolkit;
	
	// create a new panel for the popup
	var popup = dctk.createPanelCtrl("popup", true);
	popup.width = 320;
	popup.height = 340;
	popup.outlined = true;
	popup.filled = true;
	popup.color.rgb = 0x000000;
	popup.color.a = 192;
	popup.onUnhandledKeyEvent = infoPopupButtonHandler;
	
	var infoHeadTxt = dctk.createLabelCtrl("infoHeadTxt", true);
	infoHeadTxt.setRect(0, 300, 300, 334);
	infoHeadTxt.textColor.rgb = 0xCDCDCD;
	infoHeadTxt.fontSize = 26;
	infoHeadTxt.text = "Plug-in Version "+version;
	infoHeadTxt.align = dctkLabel.TS_CENTER;
	infoHeadTxt.valign = dctkLabel.TS_MIDDLE;
	popup.addChild(infoHeadTxt);
	
	var infoNoteTxt = dctk.createLabelCtrl("infoNoteTxt", true);
	infoNoteTxt.setRect(25, 200, 320, 300);
	infoNoteTxt.textColor.rgb = 0xCDCDCD;
	infoNoteTxt.fontSize = 17;
	infoNoteTxt.text = "How to use your Queue ID:\n\n From your PC...\n1.	Register for an account at Hulu.com\n 2.	Sign in and click on the 'Profile' link\n 3.	Look at your browser's address bar";
	infoNoteTxt.multiline = true;
	infoNoteTxt.align = dctkLabel.TS_LEFT;
	infoNoteTxt.valign = dctkLabel.TS_BOTTOM;
	popup.addChild(infoNoteTxt);
	
/*
	var rssIcon = dctk.createImageCtrl("rssIcon", true);
	rssIcon.setRect(40, 177, 260, 196);
	rssIcon.img.src = "rss.png";
	popup.addChild(rssIcon);
*/
	
	var infoMoreTxt = dctk.createLabelCtrl("infoMoreTxt", true);
	infoMoreTxt.setRect(25, 5, 320, 185);
	infoMoreTxt.textColor.rgb = 0xCDCDCD;
	infoMoreTxt.fontSize = 17;
	infoMoreTxt.text = "   	The numbers in the address are your Queue ID:\n \r\re.g. http://www.hulu.com/users/profile/576578\n\n From the Hulu plug-in...\n 4.	Press MENU, and input your Queue ID number\n 5.	Select 'View Queue' to save your Queue ID. \n\n Note: Your queue will appear empty until you subscribe\n to content at Hulu.com.";
	infoMoreTxt.multiline = true;
	infoMoreTxt.align = dctkLabel.TS_LEFT;
	infoMoreTxt.valign = dctkLabel.TS_TOP;
	popup.addChild(infoMoreTxt);
	
	
	// show the popup
	dctk.invokePopup(popup);
	

}
